import React from 'react'
import {
  UploadOutlined,
  // UserOutlined,
  // VideoCameraOutlined,
} from '@ant-design/icons';
import { Layout, Menu } from 'antd';
import './index.css'
import { withRouter } from 'react-router-dom'
const { Sider } = Layout;

//模拟数组结构
const menuList = [
  {
    key: "/home",
    label: "首页",
    icon: <UploadOutlined />,
  },
  {
    key: "/user-manage",
    label: "用户管理",
    icon: <UploadOutlined />,
    children: [
      { label: '用户列表', key: '/user-manage/list', icon: <UploadOutlined />, }
    ]
  },
  {
    key: "/right-manage",
    label: "权限管理",
    icon: <UploadOutlined />,
    children: [
      { label: '角色列表', key: '/right-manage/role/list', icon: <UploadOutlined />, },
      { label: '权限列表', key: '/right-manage/right/list', icon: <UploadOutlined /> }
    ]
  }]

function SideMenu(props) {
  const goToPages = (item) => {  
    props.history.push(item.key)
  }
  return (
    <Sider trigger={null} collapsible>
      <div className="logo">新闻发布系统</div>
      <Menu
        theme="dark"
        mode="inline"
        defaultSelectedKeys={['1']}
        items={menuList}
        onClick={goToPages}
      />
    </Sider>
  )
}
export default withRouter(SideMenu)
